package com.tank.demo.decorator;

import com.tank.demo.abstractFactory.BaseGameObject;

import java.awt.*;
import java.util.List;

/**
 * 白框装饰
 * 对传进来的组件进行装饰
 */
public class WhiteFrameDecorator extends Decorator {

    public WhiteFrameDecorator(List<BaseGameObject> decoratorList) {
        super(decoratorList);
    }

    @Override
    public void paint(Graphics g) {
        for (int i = 0;i<decoratorList.size();i++){
            BaseGameObject o = decoratorList.get(i);
            Color c = g.getColor();
            g.setColor(Color.WHITE);
            g.drawRect(o.x-2,o.y-2,o.width+2,o.height+2);
            g.setColor(c);

            o.paint(g);
        }
    }
}
